Link Search Menu Expand Document

Tiles and Paths

Функции


get_tile_fid

int get_tile_fid(int tile)

obj_blocking_line

ObjectPtr obj_blocking_line(ObjectPtr objFrom, int tileTo, int blockingType)

Returns first object which blocks direct linear path from objFrom to tileTo using selected blocking function (see BLOCKING_TYPE_* constants in sfall.h). If path is clear (no blocker was encountered by selected function) - returns 0. objFrom is always excluded from calculations, but is required to be a valid object.


obj_blocking_tile

ObjectPtr obj_blocking_tile(int tileNum, int elevation, int blockingType)

Returns first object blocking given tile using given blocking function or 0 if tile is clear.


path_find_to

array path_find_to(ObjectPtr objFrom, int tileTo, int blockingType)

Returns the shortest path to a given tile using given blocking function as an array of tile directions (0..5) to move on each step. Array length equals to a number of steps. Empty array means that specified target cannot be reached.


tile_by_position

funcX

int tile_by_position(int x, int y)
  • returns the tile number at the x, y position relative to the top-left corner of the screen
  • if the position is outside of the range of tiles, it will return -1

tile_get_objs

array tile_get_objs(int tileNum, int elevation)

Returns an array of all objects at given tile. It will include any hidden, dead or system objects (like cursor), so make sure to check properly when iterating.


tile_light

int tile_light(int elevation, int tileNum)

Returns light intensity at the given tile in range from 0 to 65535.


tile_refresh_display

void tile_refresh_display()

Redraws the game scene (tiles, walls, objects, etc.).


tile_under_cursor

int tile_under_cursor